<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="./reactive-01-实现基本的依赖收集.js"></script>
</head>

<body>
  <div id="app">aaa</div>

  <script>
    // 定义一个响应式数据：触发者
    const state = reactive({ name: 'xiaopang', age: 3 })
    // 定义一个副作用函数：响应者
    function effectName() {
      console.log("effectName被执行了", state.name);
      app.innerHTML = state.name
    }
    registEffect(effectName)
    function effectAge() {
      console.log("effectAge被执行了", state.age);
    }
    registEffect(effectAge)
    setTimeout(() => {
      state.name = "顿健康"
    }, 1000)

  </script>
</body>

</html>